package com.example.springstatemachine.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 任务实体类
 */
public class Task {

    private String id;
    private String name;
    private String description;
    private boolean isMulti;

    private List<String> userIds;

    private List<Transactions> fromTransactions = new ArrayList<>();

    private List<Transactions> toTransactions = new ArrayList<>();

    public Task() {

    }

    public Task(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isMulti() {
        return isMulti;
    }

    public void setMulti(boolean multi) {
        isMulti = multi;
    }

    public List<String> getUserIds() {
        return userIds;
    }

    public void setUserIds(List<String> userIds) {
        this.userIds = userIds;
    }

    public List<Transactions> getFromTransactions() {
        return fromTransactions;
    }


    public void setFromTransaction(Transactions fromTransaction) {
        this.fromTransactions.add(fromTransaction);
        fromTransaction.setFromTask(this);
    }

    public List<Transactions> getToTransactions() {
        return toTransactions;
    }

    public void setToTransaction(Transactions toTransaction) {
        this.toTransactions.add(toTransaction);
        toTransaction.setToTask(this);
    }

    @Override
    public String toString() {
        return "Task{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", fromTransactions=" + fromTransactions +
                ", toTransactions=" + toTransactions +
                '}';
    }
}
